package com.A21.GuoSai.demo.service_entity.entity.atom;

import com.A21.GuoSai.demo.service_entity.entity.workflow.DynamicVarValuePojo;
import com.A21.GuoSai.demo.service_entity.entity.workflow.StaticVarValuePojo;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.Date;
import java.util.List;

@Data
@ToString
@Setter
@Getter
public class AtomServicePojo {
    private Integer atomId;
    //原子服务类型（订单类服务、身份类服务...）
    private String type;
    //原子服务名称
    private String name;
    private String methodInfo;
    private String atomDesc;
    private String attributeConnect;
    private Boolean status;
    private Integer usageNum;
    private Integer rightNum;
    private Integer WrongNum;
//    原子服务的复杂性
    private Complexity complexity;
    private Date createdDate;
    private String authorName;
    //静态变量
    private List<StaticVarValuePojo> staticVarList;
    //动态变量
    private List<DynamicVarValuePojo> dynamicVarList;

    public AtomServicePojo() {
        createdDate=new Date();
    }

    public AtomServicePojo(String type, String name) {
        this();
        this.type = type;
        this.name = name;
    }

    public AtomServicePojo(String type, String name, String methodInfo) {
        this(type, name);
        this.methodInfo = methodInfo;
    }

    public void setComplexity(Integer a) {
        switch (a){
            case 0:this.complexity = Complexity.Low;break;
            case 1:this.complexity = Complexity.Middle;break;
            case 2 :this.complexity = Complexity.High;break;
            default:
                this.complexity = Complexity.Wrong;
        }
    }
}
